<template>
  <div>
    <a-table ref="table" rowKey="id" :columns="columns" :paganization="false"
             :dataSource="pageData">
      <!--操作-->
      <template slot="action" slot-scope="text, record">
        <a-button @click="onDetail(record)" type="link" style="padding: 0; color: #333">详情</a-button>
      </template>
    </a-table>
    <!-- <DetailModal ref="detailModalId"/> -->
    <!-- <AddModal ref="addModalId" /> -->
    <!--    <DetailDrawer ref="DetailDrawer"></DetailDrawer>-->
    <DetailDrawer ref="DetailDrawer"></DetailDrawer>
  </div>
</template>

<script>
import pulldown from '../../../modules/pulldown'
import {holoArchivePsyCounSel} from "@api/sjsk/archives";
import DetailDrawer from './DetailDrawer.vue'

export default {
  components: {
    pulldown,
    DetailDrawer
  },
  data() {
    return {
      id: this.$store.state.holographicArchives.routeObjData.sjskId,
      type:'1',
      loading: false,
      columns: [
        {
          title: '序号',
          dataIndex: 'order',
          width: 60,
          align: 'center',
          customRender: (text, record, index) =>
            `${(this.pageFilter.pageNo - 1) * this.pageFilter.pageSize + (index + 1)}` //序号分页后连续
        },
        {
          title: '访谈次数',
          dataIndex: 'consultNum',
          align: 'center',
          customRender: (text) => {
            return text ? `第${text}次` : '-'
          },
        },
        {
          title: '谈话方式',
          dataIndex: 'conversationStyle',
          align: 'center',
          customRender: (text) => {
            return <j-ellipsis value={text == 1 ? '线上咨询' : '线下咨询'} length={20} />
          },
        },
        {
          title: '预约时间',
          align: 'center',
          customRender: (text) => {
            return <j-ellipsis value={text.appointStartTime + ' - ' + text.appointEndTime } length={14} />
          },
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'consultStatus',
          scopedSlots: { customRender: 'status' },
        },
        {
          title: '谈话时间',
          align: 'center',
          customRender: (text) => {
            return <j-ellipsis value={text.consultStartTime || '' + ' - ' + (text.consultEndTime || '') } length={14} />
          },
        },
        {
          title: '操作',
          width: 300,
          align: 'center',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
        },
      ],
      pageFilter: {
        pageNo: 1,
        pageSize: 10,
      },
      pageData: [],
    }
  },
  created() {
    // this.personId = this.$route.query.personId
  },
  async mounted() {
    // this.onQuery()
    // this.getHistory()
  },

  methods: {
    getHistory() {
      holoArchivePsyCounSel({id: this.id,type:this.type}).then(res => {
        this.pageData = res.result
      })
    },
    onDetail(record) {
      this.$refs.DetailDrawer.show(record)
    },
  },
}
</script>
<style lang="less" scoped>
.s1 {
  font-size: 20px;
  font-weight: bold;
}

.s2 {
  color: #04B615;
}

.s3 {
  margin-left: 30px;
}
</style>
